<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/business/include/doctype.jsp" %>
<script>
	var i=1;
	var j=1;
	var k=1;
	$(document).ready(function(){
		if('<%= request.getParameter("type")%>' == "GROUP") {
			$('#effect1').show();
			$('#effect2').hide();
			$('#effect3').hide();
			$( "#more1" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow2.gif");
			i++;
		}else if('<%= request.getParameter("type")%>' == "COMPANY") {
			$('#effect1').hide();
			$('#effect2').show();
			$('#effect3').hide();
			$( "#more2" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow2.gif");
			j++;
		}else if('<%= request.getParameter("type")%>' == "DEPT") {
			$('#effect1').hide();
			$('#effect2').hide();
			$('#effect3').show();
			$( "#more3" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow2.gif");
			k++;
		}else{
			$('#effect1').hide();
			$('#effect2').hide();
			$('#effect3').hide();
		}
	});
	$(function() {
		function runEffect(id) {
			var selectedEffect = "blind";
			var options = {};
			if ( selectedEffect === "scale" ) {
				options = { percent: 0 };
			} else if ( selectedEffect === "size" ) {
				options = { to: { width: 200, height: 60 } };
			}

			$( "#"+id ).toggle( selectedEffect, options, 500 );
		};
		
		// set effect from select menu value
		$( "#button1" ).click(function() {
			runEffect("effect1");
			i++;
			if(i%2==0) {
				$( "#more1" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow2.gif");
			}else{
				$( "#more1" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow.gif");
			}
			return false;
		});
		
		$( "#button2" ).click(function() {
			runEffect("effect2");
			j++;
			if(j%2==0) {
				$( "#more2" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow2.gif");
			}else{
				$( "#more2" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow.gif");
			}
			return false;
		});
		
		$( "#button3" ).click(function() {
			runEffect("effect3");
			k++;
			if(k%2==0) {
				$( "#more3" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow2.gif");
			}else{
				$( "#more3" ).attr('src', "${requestScope.contextPath}/images/reservation/arrow.gif");
			}
			return false;
		});
	});
</script>

</head>
<body>
	<div id="wrap">
		<div class="header">
			<h1>자원예약</h1>
		</div><!-- // header -->
		<div class="content reservation">		
			<h2 onclick="" id="button1">그룹자원<span class="arrow"><img id="more1" src="${requestScope.contextPath}/images/reservation/arrow.gif" alt="" /></span></h2>
			<div class="toggler">
				<div id="effect1" style="display:none">
					<ul class="news">
					<c:forEach items="${mapList}" var="mapInfo" varStatus="status">
						<c:choose>
	       					<c:when test="${mapInfo.SubCount != '0' and mapInfo.IsSubDepth eq 'TRUE'}">
	       						<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceResSubList.do?ResType=View&ResType=${ResType }&type=GROUP&catid=${mapInfo.ResourceCode}&ResourceNM=${mapInfo.ResourceNMUtf}'">
									${mapInfo.ResourceNM} 
									<span class="arrow"><img src="${requestScope.contextPath}/images/board/arrow.gif" alt="" /></span>
								</li>
	       					</c:when>
	       					
	       					<c:when test="${mapInfo.SubCount != '0' and mapInfo.IsSubDepth eq 'FALSE'}">
	       						<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceResDetailList.do?ResType=View&ResType=${ResType }&type=GROUP&catid=${mapInfo.ResourceCode}&ResourceNM=${mapInfo.ResourceNMUtf}'">
									${mapInfo.ResourceNM} 
								</li>
	       					</c:when>
	       					
							<c:otherwise>
								<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceResView.do?strResourceType=GROUP&strResourceID=${mapInfo.ResourceCode}&ResourceNM=${mapInfo.ResourceNMUtf}'">
									${mapInfo.ResourceNM} 
								</li>
							</c:otherwise>
						</c:choose>
					</c:forEach>
					</ul>
				</div>
			</div>
		</div><!-- // content -->
		<div class="content reservation">
			<h2 onclick="" id="button2">회사자원<span class="arrow"><img id="more2" src="${requestScope.contextPath}/images/reservation/arrow.gif" alt="" /></span></h2>
			<div class="toggler">
				<div id="effect2" style="display:none">
					<ul class="news">
					<c:forEach items="${mapList2}" var="mapInfo2" varStatus="status">
						<c:choose>
	       					<c:when test="${mapInfo2.SubCount != '0' and mapInfo2.IsSubDepth eq 'TRUE'}">
	       						<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceResSubList.do?ResType=${ResType }&type=COMPANY&catid=${mapInfo2.ResourceCode}&ResourceNM=${mapInfo2.ResourceNMUtf}'">
									${mapInfo2.ResourceNM} 
									<span class="arrow"><img src="${requestScope.contextPath}/images/board/arrow.gif" alt="" /></span>
								</li>
	       					</c:when>
	       					<c:when test="${mapInfo2.SubCount != '0' and mapInfo2.IsSubDepth eq 'FALSE'}">
	       						<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceResDetailList.do?ResType=${ResType }&type=COMPANY&catid=${mapInfo2.ResourceCode}&ResourceNM=${mapInfo2.ResourceNMUtf}'">
									${mapInfo2.ResourceNM} 
								</li>
	       					</c:when>
							<c:otherwise>
								<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceRes<c:if test="${ResType eq 'Write'}">Write</c:if><c:if test="${ResType != 'Write'}">View</c:if>.do?strResourceType=COMPANY&strResourceID=${mapInfo2.ResourceCode}&ResourceNM=${mapInfo2.ResourceNMUtf}'">
									${mapInfo2.ResourceNM}
								</li>
							</c:otherwise>
						</c:choose>
						
					</c:forEach>
					</ul>
				</div>
			</div>
		</div><!-- // content -->
		<div class="content reservation">
			<h2 onclick="" id="button3">부서자원<span class="arrow"><img id="more3" src="${requestScope.contextPath}/images/reservation/arrow.gif" alt="" /></span></h2>
			<div class="toggler">
				<div id="effect3" style="display:none">
					<ul class="news">
					<c:forEach items="${mapList3}" var="mapInfo3" varStatus="status">
						<c:choose>
	       					<c:when test="${mapInfo3.SubCount != '0' and mapInfo.IsSubDepth eq 'TRUE'}">
	       						<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceResSubList.do?ResType=${ResType }&type=DEPT&catid=${mapInfo3.ResourceCode}&ResourceNM=${mapInfo3.ResourceNMUtf}'">
									${mapInfo3.ResourceNM} 
									<span class="arrow"><img src="${requestScope.contextPath}/images/board/arrow.gif" alt="" /></span>
								</li>
	       					</c:when>
	       					<c:when test="${mapInfo.SubCount != '0' and mapInfo.IsSubDepth eq 'FALSE'}">
	       						<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceResDetailList.do?ResType=${ResType }&type=DEPT&catid=${mapInfo3.ResourceCode}&ResourceNM=${mapInfo3.ResourceNMUtf}'">
									${mapInfo3.ResourceNM} 
								</li>
	       					</c:when>
							<c:otherwise>
								<li onclick="location.href='${requestScope.contextPath}/business/mResourceRes/mResourceRes<c:if test="${ResType eq 'Write'}">Write</c:if><c:if test="${ResType != 'Write'}">View</c:if>.do?strResourceType=DEPT&strResourceID=${mapInfo3.ResourceCode}&ResourceNM=${mapInfo3.ResourceNMUtf}'">
									${mapInfo3.ResourceNM} 
								</li>
							</c:otherwise>
						</c:choose>
					</c:forEach>
					</ul>
				</div>
			</div>
		</div><!-- // content -->
	</div><!-- // wrap -->
	<script>
		window.HybridApp.clearAllHistory(); 
	</script>
</body>
</html>